$(function () {
    let markid = getUrlString('markid');
    let isApp = getUrlString('isApp');
    function redList () {
        var data = {
            'markid':markid,
            'page':0
        };
        getData('post','/niu/apiv4/niu_daoju_number.php',data,function (data) {
            console.log(data);
            $('#jinbiNum').html(data.JinBi);
            $('#PuTong').html(data.PuTong+'张');
            $('#XianDing').html(data.XianDing+'张');
            $('#XuQi').html(data.XuQi+'张');
            $('#YunFei').html(data.YunFei+'张');
        })
    }

    redList();

    $('.jinbiLi').click(function () {
        if (isApp === '1' || isApp === '2'){
            window.location.href = urlView+'cup/redPacket.html?type=0&markid='+markid+'&isApp=1'
        } else {
            window.location.href = 'dancool://web='+urlView+'cup/redPacket.html?type=0'
        }
    });

    $('.ptndLi').click(function () {
        if (isApp === '1' || isApp === '2'){
            window.location.href = urlView+'cup/cup.html?type=7&markid='+markid+'&isApp='+isApp
        } else {
            window.location.href = 'dancool://web='+urlView+'cup/cup.html?type=7'
        }

    });

    $('.xqLi').click(function () {
        if (isApp === '1' || isApp === '2'){
            window.location.href = urlView+'cup/cup.html?type=1&markid='+markid+'&isApp='+isApp
        } else {
            window.location.href = 'dancool://web='+urlView+'cup/cup.html?type=1'
        }

    });

    $('.yfLi').click(function () {
        if (isApp === '1' || isApp === '2'){
            window.location.href = urlView+'cup/cup.html?type=0,2&markid='+markid+'&isApp='+isApp
        } else {
            window.location.href = 'dancool://web='+urlView+'cup/cup.html?type=0,2'
        }

    });

    $('.xdndLi').click(function () {
        if (isApp === '1' || isApp === '2'){
            window.location.href = urlView+'cup/cup.html?type=3,4,5,6&markid='+markid+'&isApp='+isApp
        } else {
            window.location.href = 'dancool://web='+urlView+'cup/cup.html?type=3,4,5,6'
        }

    });
    if (isApp !== '1' && isApp !== '2'){
        //调用app跳往优惠券记录
        nativeCommand('dancool://titlebar=rightimg|record|nativeCommand("dancool://fullweb='+urlView+'cup/redRecord.html?type=1");');
    }
});
